﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ACSR.SqlServer.AddIn.Core.Controllers;
using System.Windows.Forms;

namespace SSMSProcedureList.Controllers
{
    public class ProcedureListController : AddInController
	{
        public ProcedureListController(object addInInst) : base(addInInst)
        {
            //MessageBox.Show("ProcedureListController: Creating");
        }

        protected override void InternalOnConnectionCompleted()
        {
            MessageBox.Show("InternalOnConnectionCompleted");
            
        }

        protected override void InternalOnStartupCompleteCompleted(ref Array custom)
        {
            MessageBox.Show("InternalOnStartupCompleteCompleted");
            try
            {
                var bar = CreateCommandBar("ProcedureList2");

                AddCommand(bar, "ProcedureList2", "ProcedureListtext", "Showsprocedures", 13);
                LogMessage("ProcedureListController: InternalOnStartupCompleteCompleted");
            }
            catch (Exception e)
            {
                LogError("Error ProcedureListController.InternalOnStartupCompleteCompleted: " + e.Message);
            }
        }

        protected override void InternalExec(string CmdName, EnvDTE.vsCommandExecOption ExecuteOption, ref object VariantIn, ref object VariantOut, ref bool Handled)
        {
            MessageBox.Show("Executing:" + AddInInstance.DTE.ActiveWindow.Caption);
        }
	}
}
